/*
 * @Author: chenr 526963089@qq.com
 * @Date: 2023-02-10 10:19:22
 * @LastEditors: chenr 526963089@qq.com
 * @LastEditTime: 2023-02-27 17:40:31
 * @Description:
 */
import { createRouter, createWebHashHistory } from 'vue-router';
import type { RouterInterface } from './types';
import type { RouteRecordRaw } from 'vue-router';

// 前端未找到页面路由（固定不用改
export const notFoundRouter: RouterInterface = {
  path: '/:catchAll(.*)',
  redirect: '/404',
  meta: { title: '404', hidden: true },
};

/* 基础路由 */
const constantRouterMap: RouterInterface[] = [
  {
    path: '/',
    name: '官网',
    redirect: '/official',
  },
  {
    path: '/403',
    name: '403',
    component: () => import('@/views/403.vue'),
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404.vue'),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: [...constantRouterMap] as RouteRecordRaw[],
});

export default router;
